package com.xinsoft.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xinsoft.entity.dto.InOrOutStock;
import com.xinsoft.entity.dto.ScmStockDTO;
import com.xinsoft.entity.dto.ScmStockParam;
import com.xinsoft.entity.po.ScmStock;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xinsoft.entity.po.ScmStockHis;

import java.util.List;

/**
* @author ZYM
* @description 针对表【scm_stock(库存表)】的数据库操作Service
* @createDate 2023-08-15 15:42:43
*/
public interface ScmStockService extends IService<ScmStock> {

    IPage<ScmStockDTO> findPageListByParam(ScmStockParam param);

    List<ScmStockDTO> findListByParam(ScmStockParam param);

    ScmStockDTO findTotalByParam(ScmStockParam param);

    /**
     * 保存库存变动
     * @param stockHisList 库存变动记录
     * @param stockList 库存
     */
    @Deprecated
    void saveInventoryChange(List<ScmStockHis> stockHisList, List<ScmStock> stockList);

    /**
     * 更新库存
     * @param sourceBillType   单据类型
     * @param sourceCode 来源单据编号
     * @param itemList   变动列表
     * @param changeType 变动类型（0减少，1增加）
     */
    void updateInventory(Integer sourceBillType, String sourceCode, List<InOrOutStock> itemList, Integer changeType);
}
